package com.jrx.anytxn.transaction.job.consumeRemind.step;

import com.jrx.anytxn.transaction.constant.TransBizConstant;
import com.jrx.anytxn.transaction.entity.AmLoanMainInfo;
import com.jrx.anytxn.transaction.service.ISmsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.batch.item.ItemProcessor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 消费提醒 - processor
 *
 * @author bowen.liu
 */
@Service
public class ConsumeRemindProcessor implements ItemProcessor<AmLoanMainInfo, AmLoanMainInfo> {

    @Autowired
    private ISmsService iSmsService;

    Logger logger = LoggerFactory.getLogger(ConsumeRemindProcessor.class);

    @Override
    public AmLoanMainInfo process(AmLoanMainInfo amLoanMainInfo) throws Exception {
        logger.info("开始发送{}客户的loanId为{}的消费提醒短信", amLoanMainInfo.getCustomerId(), amLoanMainInfo.getLoanId());
        iSmsService.sendSmsMq(amLoanMainInfo, TransBizConstant.SMS_TYPE_LOAN);
        return amLoanMainInfo;
    }
}
